
#ifndef SW_WRITER_H
#define SW_WRITER_H

#include <string>
#include "util/dtk_maindoc_ptr.hpp"
#include "WriterBase.hpp"

namespace AMCAX::Exchange
{
    class SolidworksWriter : public WriterBase
    {
    public:
        Dtk_ErrorStatus WriteInit(Dtk_string DumpFile, const Dtk_string& inOutputFolder) override;
        Dtk_ErrorStatus WriteEnd() override;

        Dtk_ErrorStatus CreateAssembly(Dtk_ComponentPtr inComponent, Dtk_ID& outAssemblyId) override;
        Dtk_ErrorStatus CloseAssembly(const Dtk_ComponentPtr& inComponent) override;
        void InitComponent(Dtk_ComponentPtr inComponent) override;
        void EndComponent(Dtk_ComponentPtr inComponent) override;

        // MetaData
        void WriteMetaData(const Dtk_MetaDataPtr& inMetaData) override;
        // Mesh
        void WriteMesh(Dtk_MeshPtr& inMeshToWrite, Dtk_tab<Dtk_ID>& outIds) override;
        // Body(contains curve, point, plan, axis, esquisse3d, esquisse2d)
        void WriteBody(Dtk_BodyPtr& inBody, Dtk_tab<Dtk_ID>& outIds) override;
        // Axis
        void WriteAxisSystem(const Dtk_AxisSystemPtr& inAxis) override;
        // Fdt
        void WriteFdt(const Dtk_FdtPtr& inFdt) override;

    private:
        Dtk_ErrorStatus OpenPart(const Dtk_string& outputFileName);
        void ClosePart();
        Dtk_ErrorStatus OpenAssembly(const Dtk_string& outputFileName);
        void CloseAssembly();

    private:
        // Output file full path.
        Dtk_string m_outputFileName;
    };
}
#endif